const crypto = require('crypto')

// 密钥
const SECRET_KEY = 'WJiol_8776#'

// MD5 加密
function md5(content) {
    let md5 = crypto.createHash('md5')
    return md5.update(content).digest('hex')
}

// 加密函数
function genPassword(password) {
    const str = `password=${password}&key=${SECRET_KEY}`
    return md5(str)
}

//const result = genPassword('a123456')
//console.log(result)
// eaa65ff3f533106c3a42c40544c1e618

module.exports = {
    genPassword
}